package com.nabi.library.contents.elements.style
{
	import flash.display.BitmapData;
	import flash.display.Graphics;
	import flash.geom.Matrix;
	
	public class BitmapFill implements IFill
	{
		private var m_bitmapData:BitmapData;
		private var m_matrix:Matrix;
		
		public function BitmapFill($bitmapData:BitmapData, $matrix:Matrix = null)
		{
			SetBitmapData($bitmapData);
			SetMatrix($matrix);
		}
		
		public function Draw($graphic:Graphics, $matrix:Matrix = null): void
		{
			if(m_matrix) {
				$graphic.beginBitmapFill(m_bitmapData, m_matrix, true, true);
			} else {
				$graphic.beginBitmapFill(m_bitmapData, $matrix, true, true);
			}
		}
		
		public function GetBitmapData(): BitmapData { return m_bitmapData; }
		
		public function SetBitmapData($bitmapData:BitmapData): void { m_bitmapData = $bitmapData; }
		
		public function GetMatrix(): Matrix { return m_matrix; }
		
		public function SetMatrix($matrix:Matrix): void { m_matrix = $matrix; }
	}
}